<?php

quanli_require('framework/smarty/libs/SmartyBC.class.php');

class smartyFactory {

    public static function create() {

        $s = new SmartyBC();

        if (G_SHOP_SUBSITE == 'shop') { //web前台

            $theme_root = G_THEME_ROOT;

        } elseif ( G_SHOP_SUBSITE == 'backend' ) { //后台或商户后台

            $theme_root = G_APPLICATION_BASEPATH . 'quanliadmin/docroot/templates';

        } elseif ( G_SHOP_SUBSITE == 'wap' ) {

            $theme_root = G_THEME_ROOT;

        }
        //add by  allen.qiang  2015年1月21日 下午茶FUN-AC-0028 start
        elseif(G_SHOP_SUBSITE == 'dunch' ){

            $theme_root = G_THEME_ROOT;
        }
        //add by  allen.qiang  2015年1月21日 下午茶FUN-AC-0028 end
        $s->template_dir = $theme_root . '/tpls/';
        if (!file_exists($theme_root . '/compiled/')) {
            mkdir($theme_root . '/compiled/', 0777, true );
        }
        $s->compile_dir = $theme_root . '/compiled/';
        $s->config_dir = $theme_root . '/configs/';
        $s->cache_dir = $theme_root . '/cache/';
        $s->caching = 0;
        $s->left_delimiter = '<!--{';
        $s->right_delimiter = '}-->';

        //注册加载静态文件插件 add by allen.qiang 2015-06-03
        $s->registerPlugin('function','load_script','loadScript');

        return $s;

    }
}